<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Python代码编辑器</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/python/python.min.js"></script>
    <style>
        .CodeMirror {
            border: 1px solid #eee;
            height: auto;
        }
    </style>
</head>
<body>
<div><button id="run">执行</button></div>
<textarea id="editor">print("Hello, World!")</textarea>

<script>
  var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
    mode: "python",
    lineNumbers: true
  });
  document.getElementById("run").addEventListener("click",function(){
      var shell = new ActiveXObject("WScript.Shell"); //创建WScript.Shell对象
      shell.Run("D:\\Language\\Java\\jdk1.8.0_301\\bin\\java.exe -version", 1); //指定exe文件路径并设置参数为1表示最大化窗口打开
  })
</script>

</body>
</html>